State
Fix relay reconnect
default
the reconnect loop dies after the 3rd retry — can you find why and add a regression test?
The backoff timer lives on the socket’s own scope, which is cancelled when the socket closes. I hoisted it to an app-level scope and touched a handful of files.
Bashgradle :relay:test
Tests pass. 8 files changed — tap to review.
Files changed
8 files · +214 −38
M
App.tsx
src/app
+12 −3×3
A
useDiff.ts
src/hooks
+48
M
WsClient.rs
src/net/relay
+31 −9
A
0007_add_diffs.sql
db/migrations
+42
M
theme.css
src/styles
+6 −6×2
D
legacy_api.py
src/server/api
−120
A
hero@2x.png
assets/images
N
explore.ipynb
analysis/notebooks
+18 −4
Row anatomy
- Status glyph — 20×20 rounded square, mono bold: A added · M modified · D deleted · N notebook.
- Middle — filename 14 medium, ellipsized, over the tail of its directory (11 mono muted).
- Right — mono +N −M, a muted ×3 edit-count when a file was touched more than once. Deleted rows show only −120; image rows show an image glyph.
State
App.tsx
src/app
+12 −3M
Diff truncated — showing first 200 of 480 KB.
Line-level diffs need a newer daemon.
Run the update command on your computer.
@@ −18,7 +18,9 @@
export function ChangedFiles
7 lines
copy
1818import { useState } from 'react'
1919import { Sheet } from './Sheet'
20−import { fetchFiles } from './api'
20+import { fetchFiles, fetchDiff } from './api'
21+import { useDiff } from '../hooks/useDiff'
2122
2223export function ChangedFiles({ session }: Props) {
42 unchanged lines
2324 const { data } = useSession(sessionId)
2425 const [tab, setTab] = useState('diff')
@@ −64,5 +70,9 @@
const label = files.length
7 lines
copy
6470 const [active, setActive] = useState(0)
6571 const files = data?.files ?? []
66− const label = files.length + ' files'
72+ const label = `${files.length} files · +${adds}`
73+ const { diff, loading } = useDiff(files[active])
6774
6875 return (
@@ −96,4 +104,6 @@
return (
6 lines
copy
96104 <Sheet title="Files changed">
97105 <Summary stat={stat} />
106+ {loading && <DiffSkeleton rows={3} />}
107+ {diff && <UnifiedDiff hunks={diff.hunks} />}
98108 </Sheet>
99109 )
Diff grammar (shared with desktop)
- Hunk band — @@ −64,5 +70,9 @@ in muted mono on a raised full-width band; tap to collapse (collapsed = chevron + “7 lines”).
- Added rows carry a + and a 12% success tint under readable primary text; removed rows a − and a 12% danger tint with slightly dimmed text; context is plain secondary, 3 lines around each hunk.
- ⋯ separator collapses distant runs (“42 unchanged lines”, tap to expand). A quiet mono line-number gutter stays lighter than the code. Monospace throughout, horizontal scroll, no wrap.
State
Lidapeng-MBP
Projects
cc-pocket
relay
Sessions
Fix relay reconnect
Add WS reconnect test
Refactor auth module
Settingsv0.5.0
Fix relay reconnect
default
± 8
~/code/cc-pocket · ⑂ main · sonnet
YOU
the websocket reconnect dies after the 3rd retry — can you find why and add a regression test?
The backoff timer is scheduled on the socket’s own scope, which is cancelled the moment the socket closes. Hoisting it to an app-level scope fixes it. I touched 8 files.
Bashgradle :relay:test
Tests pass. The reconnect now survives socket-scope cancellation.
Changes8 files · +214 −38
A+48
useDiff.ts
src/hooks
M+31 −9
WsClient.rs
src/net/relay
M+12 −3
App.tsx
src/app
A+42
0007_add_diffs.sql
db/migrations
M+6 −6
theme.css
src/styles
D−120
legacy_api.py
src/server/api
A
hero@2x.png
assets/images
N+18 −4
explore.ipynb
analysis/notebooks
~/code/cc-pocket/src/app/App.tsx
M+12 −3
@@ −18,7 +18,9 @@export function ChangedFiles7 linescopy hunk
1818import { useState } from 'react'
1919import { Sheet } from './Sheet'
20−import { fetchFiles } from './api'
20+import { fetchFiles, fetchDiff } from './api'
21+import { useDiff } from '../hooks/useDiff'
2122
2223export function ChangedFiles({ session }: Props) {
42 unchanged lines
2324 const { data } = useSession(sessionId)
2425 const [tab, setTab] = useState('diff')
@@ −64,5 +70,9 @@const label = files.length7 linescopy hunk
6470 const [active, setActive] = useState(0)
6571 const files = data?.files ?? []
66− const label = files.length + ' files'
72+ const label = `${files.length} files · +${adds}`
73+ const { diff, loading } = useDiff(files[active])
6774
6875 return (
@@ −96,4 +104,6 @@return (6 linescopy hunk
96104 <Sheet title="Files changed">
97105 <Summary stat={stat} />
106+ {loading && <DiffSkeleton rows={3} />}
107+ {diff && <UnifiedDiff hunks={diff.hunks} />}
98108 </Sheet>
99109 )
↑↓ switch file⏎ focus diff⌥←→ collapse/expand hunkesc close
Chat header · new “± 8” entry (left of ⋯)
Fix relay reconnect
default
± 8
~/code/cc-pocket · ⑂ main · sonnet